package xj.graph2d.app.prop;

import static xj.app.BaseApplicationFrame.getResourceString;

import xj.graph2d.app.DrawApp;
import xj.model.uml.Enumeration;
import xj.model.uml.Visibility;

public class UMLEnumModelPane 
  extends UMLBasicModelPane {

  public UMLEnumModelPane(DrawApp main) {
    super(main);
    enumName = new ModelPropertiesPane.NameField("name", 
						  getResourceString("EnumName.text"));
    addRow(enumName);

    Visibility[] values = { Visibility.Public, Visibility.Package };
    visibility = new ModelPropertiesPane.ChoiceField("visibility", 
						     getResourceString("Visibility.text"), 
						     values);
    addRow(visibility);


    addBasicFields();

    addFiller();
  }

  protected ModelPropertiesPane.NameField enumName;

  protected ModelPropertiesPane.ChoiceField visibility;

  protected static String getEnumName(Enumeration e) {
    String ename = null;
    if (e != null) {
      ename = e.getName();
      if (ename != null) {
	ename = ename.trim();
	if (ename.length() == 0) {
	  ename = "<unnamed>";
	}
      } else {
	ename = "<unnamed>";
      }
    } else {
      ename = "<unnamed>";
    }
    return ename;
  }



}